// custom-tab-bar/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    selected: {
      type: Number,
      value: 0
    },
    tabtype: {
      type: String,
      value: ''
    }

  },

  /**
   * 组件的初始数据
   */
  data: {
    // selected: 0,
    color: "#194063",
    selectedColor: "#FFFFFF",
    list: [{
      "pagePath": "/pages/home/index",
      "iconPath": "../static/tabbar/tab_home.png",
      "selectedIconPath": "../static/tabbar/tab_home_select.png",
      "text": "首页",

    },
    {
      "pagePath": "/pages/order/index",
      "iconPath": "../static/tabbar/tab_order.png",
      "selectedIconPath": "../static/tabbar/tab_order.png",
      "text": "点单",

    },
    {
      "pagePath": "",
      "iconPath": "",
      "selectedIconPath": "",
      "text": "",

    },
    {
      "pagePath": "/pages/logo/index",
      "iconPath": "../static/tabbar/tab_logo.png",
      "selectedIconPath": "../static/tabbar/tab_logo.png",
      "text": "lgog商城",

    },

    {
      "pagePath": "/pages/mine/index",
      "iconPath": "../static/tabbar/tab_mine.png",
      "selectedIconPath": "../static/tabbar/tab_mine_select.png",
      "text": "我的",
    }],
    background: '../static/tabbar/tabbarbg.png', //背景图
    centerImg: '../static/tabbar/tab_yuzhou.png',
    centerTitle: '创界元宇宙世界',
    centerImgPhone: '../static/tabbar/tab_phone.png',
    centerPhone: '上传照片',
    showAddLogo: false
  },


  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      let detail = e.currentTarget.dataset
      let id = detail.index
      this.setData({
        selected: id
      })

      switch (id) {
        case 0:
          wx.redirectTo({
            url: '/pages/home/index',
          });
          break;
        case 1:
          wx.navigateTo({
            url: '/pages/order/index',
          });
          break;

        case 3:
          wx.redirectTo({
            url: '/pages/logo/index',
          });

        case 4:
          wx.redirectTo({
            url: '/pages/mine/index',
          });
          break;
      }



    },

    toEarth() {
      console.log('webview');
    },

    toAddLogo() {
      this.setData({
        showAddLogo: true
      })
    },

    onCloseAdd() {
      this.setData({
        showAddLogo: false
      })
    },
    subAddLogo() {
      console.log('addlogo');
      this.setData({
        showAddLogo: false
      })
    }



  }
})
